#include "DateTimeTickerText.h"

DateTimeTickerText::DateTimeTickerText()
	: QCPAxisTickerText()
{
}

DateTimeTickerText::~DateTimeTickerText()
{
}

double DateTimeTickerText::getTickStep(const QCPRange &range)
{
	double exactStep = range.size() / double(mTickCount + 1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers
	return cleanMantissa(exactStep);
}

QVector<double> DateTimeTickerText::createTickVector(double tickStep, const QCPRange &range)
{
	QVector<double> result = QCPAxisTickerText::createTickVector(tickStep, range);
	double minVal = result.front();
	double maxVal = result.back();
	double maxValExt = maxVal + 1;
	QVector<double> newRes;
	for (double pVal = minVal; pVal < maxValExt; pVal += tickStep)
	{
		newRes.push_back(pVal);
	}
	return newRes;
}
